Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added notification support for new items being added to a library #3464

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

silvercolt
Copy link

Supports the client upload method (one or more items), or folder changes. I tested each scenario locally through docker and using Pipedream webhooks to receive the notification event.

…pports the client upload method (one or more items), or folder changes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You will want to edit the file in docs/objects/Notification.yaml to add the new element to the NotificationEventName. The docs/openapi.json is automatically generated from those files and should not be edited directly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, whoops. I misread the previous edit, disregard.

}
itemGroupingResults[itemDir] = newLibraryItem ? ScanResult.ADDED : ScanResult.NOTHING
}

return itemGroupingResults
}
}
module.exports = new LibraryScanner()
module.exports = new LibraryScanner(new NotificationManager())
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The server doesn't run because NotificationManager is not defined.
We wouldn't want to instantiate a new instance of NotificationManager though because it is already instantiated in Server.js.
The NotificationManager could be made a singleton like the LibraryScanner so it can be imported anywhere

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated it to a singleton so you can merge master to fix
7cd8d7f

Copy link
Author

@silvercolt silvercolt Sep 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, I ran the server just fine with the new instantiation of NotificationManager here. Maybe I missed something when migrating my changes from a branch off master to my fork. Agreed, a singleton would have been better, but I didn't feel comfortable making a sweeping change like that, so I appreciate the enhancement. I will update accordingly.

@advplyr
Copy link
Owner

advplyr commented Sep 28, 2024

#2228

The main reason I hesitated on adding this feature is what I described here: #996 (comment)

When testing this I scanned in a new library and it queued up dozens of emails. For some users it could be 10k+ emails. I'm not sure the best way to handle that.

The other issue I have with this is the notification is named onItemsAdded when it doesn't handle podcast library items and it is only one library item so should be onItemAdded

@silvercolt
Copy link
Author

#2228

The main reason I hesitated on adding this feature is what I described here: #996 (comment)

When testing this I scanned in a new library and it queued up dozens of emails. For some users it could be 10k+ emails. I'm not sure the best way to handle that.

The other issue I have with this is the notification is named onItemsAdded when it doesn't handle podcast library items and it is only one library item so should be onItemAdded

These are valid concerns, I appreciate referencing the previous conversation for added context. Let me think about this and see if I can propose a potential solution that will help address these. There will be some UI changes needed to give the user some added control over the library, notification thresholds/limits (n > items consolidate into a single notification, restrict notification event to specific library(ies), be more specific about what kind of item: book, podcast, disable option when adding a new library, allow users to un/subscribe to notifications, potentially an option as an Admin to manually trigger a notification via the book's details page, etc.).

I do think this is worth solving as there are many out there looking for this feature like I am - hence the motivation to try and contribute to its solution. I am currently wanting to send notification embeds to my private Discord server where my users are listening.

I will see if I can document a full Feature specification for this that User Stories could be groomed from for design, estimation, impact/risk, and prioritization. Maybe others could assist in the development.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants